package cn.sxt.clinic.mapper;

import cn.sxt.clinic.pojo.Registered;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since 2020-06-29
 */
public interface RegisteredMapper extends BaseMapper<Registered> {
    IPage<Registered> selectRegistered(IPage<Registered> page, @Param(Constants.WRAPPER) Wrapper wrapper);

    //
    @Select("SELECT r.registered_id,r.patient_name ,p.patients_gender,p.patients_age,p.patients_phone,r.registered_time,r.registration_type,p.patients_idcard \n" +
            "from t_registered r LEFT JOIN t_patients p \n" +
            "ON r.patient_name = p.patients_name AND r.`status` = 0 ${ew.customSqlSegment}")
    List<Map<String,Object>> getRegistered(IPage<Map<String,Object>> page,@Param(Constants.WRAPPER) QueryWrapper<Map<String,Object>> wrapper);
}
